package bookstore.bound.auth;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Base64;

public class LoginForm {
    @NotNull
    @Size(max = 127)
    private String email;
    private String pass;

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public byte[] getPass() {
        Base64.Decoder decoder = Base64.getDecoder();
        if (pass == null || pass.isEmpty()) {
            return null;
        } else {
            return decoder.decode(pass);
        }
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

}
